package notes.java.sjms23.t10_visitor;

import java.util.ArrayList;
import java.util.List;

// 对象结构，一个容器， 可以直接用List代替
public class ShapeStructure {

    private List<Shape> list = new ArrayList<>();
    
    public void add(Shape shape) {
        list.add(shape);
    }
    
    
    public void accept(Visitor visitor) {
        for(Shape shape: list) {
            shape.accept(visitor);
        }
    }
}
